<?php

require_once("inc.member.php");



$this_title="$vars[member_title] &raquo; ".replace_tag(__("<%title%> History"), array("<%title%>"=>__($vars['ewallet_title'])));

$page_title=__("Transaction History");

$content_title=__("Transaction History");



$item_per_page=$vars["user_item_per_page"];




//#####LIST EWALLET HISTORY#####

$count_sql="select count(*) from $db->member_ewallet_record where uid='$uid'";

$record_sql="select * from $db->member_ewallet_record where uid='$uid' order by cdate desc, id desc limit <%limit_start%>, <%limit%>";



$cur_page=$_GET["nav"];

$total_record=@mysql_result(mysql_query($count_sql), 0);

$total_page=ceil($total_record/$item_per_page);

$page=($cur_page? ($cur_page>$total_page? $total_page : ($cur_page<1? 1 : $cur_page)) : 1);

$limit_start=($page-1)*$item_per_page;

$nav_link=format_page($page, $total_page, 15);

$this_page_total=@mysql_num_rows($r=mysql_query(str_replace("<%limit_start%>", $limit_start, str_replace("<%limit%>", $item_per_page, $record_sql))));

$k=0;

for($i=0;$i<$this_page_total;$i++){

 $p=mysql_fetch_assoc($r);

 $his_row.="

 <tr class='row$k'>

  <td>".($i+1)."</td>

  <td>".nl2br($p["descr"])."</td>

  <td class='number'>".number_format(in_array($p['type'],array('c','credit'))? $p['amount'] : 0, 2)."</td>

  <td class='number'>".number_format(!in_array($p['type'],array('c','credit'))? $p['amount'] : 0, 2)."</td>

  <td>".nl2br($p["bal"])."</td>

  <td>".date($vars['date_format'], strtotime($p["cdate"]))."</td>

 </tr>";

 $k=1-$k;

}



//listing text

$listing_text=replace_tag(__("<%x%> <%title%> <%record%>."), array("<%x%>"=>"$total_record", "<%title%>"=>__($vars['ewallet_title']), "<%record%>"=>$total_record>1? __("records") : __("record")));



//listing

$his_list=

"<h2>".replace_tag(__("<%title%> History"), array("<%title%>"=>__($vars['ewallet_title'])))."</h2>

$listing_text $nav_link

<table class='pbl_table'>

 <tr class='pbl_header'>

  <td>".__("Trans#")."</td>

  <td>".__("Description")."</td>

  <td>".__("Credit")."</td>

  <td>".__("Debit")."</td>

  <td>".__("Balance")."</td>

  <td>".__("Date")."</td>

 </tr>

 $his_row

</table>

$nav_link";



$content=$inc_wallet_select.$his_list;

print format_member_page($content, $this_title, $content_title, $css . $inc_jvscript);

?>